<!DOCTYPE html>
<html lang="ch">
	<head>
		<meta charset="utf-8">
		<title>导航栏</title>
		<style>
			li{
				list-style-type:none;
				width:100px;
				height:50px;
				line-height:50px;
				background-color:beige;
				text-align:center;
				float:left;
				cursor:pointer;
				color:blue;
			}
			.on{
				background-color:red;
			}
			li>a{
				text-decoration:none;
			}
		</style>
	</head>
	<body>
		<div>
			<ul>
				<li>首页</li>
				<li>HTML</li>
				<li>CSS</li>
				<li>JavaScript</li>
				<li>关于</li>
				<li>帮助</li>
			</ul>
		</div>
		<script type="text/javascript">
			var tags=document.getElementsByTagName('li');
			for(var i=0;i<tags.length;i++){
				tags[i].onclick=function(){
					for(var j=0;j<tags.length;j++){
						tags[j].className='off';
					}
					this.className='on';
				}
			}
		</script>
	</body>
</html>
